﻿@page
@model FytSoa.Web.Pages.FytAdmin.Cms.ContentModel
@{
    ViewData["Title"] = "内容管理";
    Layout = AdminLayout.Pjax(HttpContext);
}
<div id="container">
    <div class="layui-col-220">
        <div class="layui-nav-title">栏目列表</div>
        <ul id="tree" class="layui-tree-cus"></ul>
    </div>
    <div class="right-col-body" id="content-body">
        abc
    </div>
    
    <script>
        layui.config({
            base: '/themes/js/modules/'
        }).use(['tree', 'layer', 'jquery', 'common', 'pjax'],
            function () {
                var layer = layui.layer,
                    $ = layui.jquery,
                    os = layui.common;
                os.ajax('api/column/tree', { type: 1 }, function (res) {
                    if (res.statusCode === 200) {
                        layui.tree({
                            elem: '#tree' //传入元素选择器
                            , nodes: res.data
                            , click: function (node) {
                                console.log(node)
                                $.pjax({ url: node.urls, container: '#content-body' });
                            }
                        });
                    } else {
                        os.error(res.message);
                    }
                });                
                $('#container').pjax('a', '#content-body',
                    {
                        fragment: "#container",
                        cache: false,
                        show: 'fade'
                    }
                );
            });
    </script>

</div>
